from django.core.files.storage import Storage
from django.conf import settings


# class FdfsStorage(Storage):
#     def open(self, name, mode='rb'):
#         pass
#
#     def save(self, name, content, max_length=None):
#         pass
#
#     def url(self, name):
#         return settings.FDFS_URL + name


class FastDFSStorage(Storage):
    """自定义文件存储类"""
    def __init__(self, fdfs_base_path=None):  # 这里要设置默认值，否则会报错
        self.fdfs_base_path = fdfs_base_path or settings.FDFS_BASE_PATH

    def open(self, name, mode='rb'):
        pass

    def save(self, name, content, max_length=None):
        pass

    # def _open(self, mode):
    #     """
    #     """
    #     pass
    #
    # def _save(self, model):
    #     """
    #
    #     """
    #     pass

    # def exists(self, name):
    #     pass

    def url(self, name):
        """
        """
        return self.fdfs_base_path + name
